﻿using Ninject.Modules;
using SmarterCharger.Library.Infrastructure;
using SmarterCharger.Library.Infrastructure.Interfaces;
using SmarterCharger.Library.Repositories;
using SmarterCharger.Library.Repositories.Interfaces;
using SmarterCharger.Library.Services;
using SmarterCharger.Library.Services.Interfaces;

namespace SmarterCharger.Library
{
    public class LibraryModule : NinjectModule
    {
        public override void Load()
        {
            LoadInfrastructure();
            LoadRepositories();
            LoadDomainServices();
        }

        private void LoadInfrastructure()
        {
            Bind<ISettingsService>().To<SettingsService>().InSingletonScope();
            Bind<IBattery>().To<BatteryWrapper>().InSingletonScope();
        }

        private void LoadRepositories()
        {
            Bind<IEnergyDeviceRepository>().To<EnergyDeviceRepository>().InSingletonScope();
            Bind<ISmartPlugRepository>().To<SmartPlugRepository>().InSingletonScope();
        }

        private void LoadDomainServices()
        {
            Bind<ISmartPlugLoader>().To<SmartPlugLoader>().InSingletonScope();
            Bind<ISmartChargeStopper>().To<SmartChargeStopper>().InSingletonScope();
        }
    }
}
